<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加</title>
    <#assign base=request.contextPath  />
    <base id="base" href="${base}">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, adminUser-scalable=0">
    <link rel="stylesheet" href="${base}/static/win10/component/layui/css/layui.css" media="all">
    <script>
        var base =  "${base}";
    </script>
</head>
<body>
<br>
<form class="layui-form " action="">
         <input type="hidden" id="id" name="id" value="${dateNo.id!}" >
          <div class="layui-form-item">
              <label class="layui-form-label">申请单位（登录用户的单位)</label>
              <div class="layui-input-block">
                  <input type="text" id="applicant" name="applicant" value="${dateNo.applicant!}"  autocomplete="off" placeholder="请输入申请单位（登录用户的单位)"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">经办人 （登录用户）</label>
              <div class="layui-input-block">
                  <input type="text" id="userId" name="userId" value="${dateNo.userId!}"  autocomplete="off" placeholder="请输入经办人 （登录用户）"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">保管人(责任人)</label>
              <div class="layui-input-block">
                  <input type="text" id="pLiable" name="pLiable" value="${dateNo.pLiable!}"  autocomplete="off" placeholder="请输入保管人(责任人)"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">获取日期</label>
              <div class="layui-input-block">
                  <input type="text" id="purchaseDate" name="purchaseDate" value="${dateNo.purchaseDate!}"  autocomplete="off" placeholder="请输入获取日期"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">资产来源（下拉选）</label>
              <div class="layui-input-block">
                  <input type="text" id="assetsSource" name="assetsSource" value="${dateNo.assetsSource!}"  autocomplete="off" placeholder="请输入资产来源（下拉选）"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">存放地点</label>
              <div class="layui-input-block">
                  <input type="text" id="depositAddress" name="depositAddress" value="${dateNo.depositAddress!}"  autocomplete="off" placeholder="请输入存放地点"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">所属单位(下拉选)</label>
              <div class="layui-input-block">
                  <input type="text" id="affiliatedUnits" name="affiliatedUnits" value="${dateNo.affiliatedUnits!}"  autocomplete="off" placeholder="请输入所属单位(下拉选)"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">0未提交/1待审批/2审批通过/3审批不通过</label>
              <div class="layui-input-block">
                  <input type="text" id="approvalState" name="approvalState" value="${dateNo.approvalState!}"  autocomplete="off" placeholder="请输入0未提交/1待审批/2审批通过/3审批不通过"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">日期单号</label>
              <div class="layui-input-block">
                  <input type="text" id="oddNumber" name="oddNumber" value="${dateNo.oddNumber!}"  autocomplete="off" placeholder="请输入日期单号"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">批次审批不通过原因</label>
              <div class="layui-input-block">
                  <input type="text" id="errerReason" name="errerReason" value="${dateNo.errerReason!}"  autocomplete="off" placeholder="请输入批次审批不通过原因"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">审批人ID</label>
              <div class="layui-input-block">
                  <input type="text" id="approvalUserId" name="approvalUserId" value="${dateNo.approvalUserId!}"  autocomplete="off" placeholder="请输入审批人ID"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">更新时间(上次审批时间)</label>
              <div class="layui-input-block">
                  <input type="text" id="updateTime" name="updateTime" value="${dateNo.updateTime!}"  autocomplete="off" placeholder="请输入更新时间(上次审批时间)"
                         class="layui-input">
              </div>
          </div>
          <div class="layui-form-item">
              <label class="layui-form-label">创建时间</label>
              <div class="layui-input-block">
                  <input type="text" id="createTime" name="createTime" value="${dateNo.createTime!}"  autocomplete="off" placeholder="请输入创建时间"
                         class="layui-input">
              </div>
          </div>

    <div align="center">
        <button type="button" class="layui-btn" id="submit">保存</button>
    </div>
</form>

<script src="${base}/static/win10/component/layui/layui.js?t=1"></script>
<script src="${base}/static/win10/js/jquery-1.8.3.min.js?t=1"></script>
<script>
    layui.use(['form', 'layer'], function() {
        var form = layui.form
                , layer = layui.layer;
        $("#submit").on("click",function () {
            if(check()===false){
                return;
            }

            var formDate = {
                         id:$("#id").val(),
                         applicant:$("#applicant").val(),
                         userId:$("#userId").val(),
                         pLiable:$("#pLiable").val(),
                         purchaseDate:$("#purchaseDate").val(),
                         assetsSource:$("#assetsSource").val(),
                         depositAddress:$("#depositAddress").val(),
                         affiliatedUnits:$("#affiliatedUnits").val(),
                         approvalState:$("#approvalState").val(),
                         oddNumber:$("#oddNumber").val(),
                         errerReason:$("#errerReason").val(),
                         approvalUserId:$("#approvalUserId").val(),
                         updateTime:$("#updateTime").val(),
                           createTime:$("#createTime").val()
            }
            $.ajax({
                type: "POST",
                url: base+"/api/dateNo/admin/editDateNo",
                data: formDate,
                success: function (data) {
                    layer.msg(data.message)
                    if (data.code === 200) {
                        window.location.href=base+"/api/dateNo/admin/main.html"
                    } else {

                    }
                }
            });
        })







        function check(){
                   if($("#applicant").val().length<1){
                       layer.msg("请输入申请单位（登录用户的单位)");
                       return false;
                   }
                   if($("#userId").val().length<1){
                       layer.msg("请输入经办人 （登录用户）");
                       return false;
                   }
                   if($("#pLiable").val().length<1){
                       layer.msg("请输入保管人(责任人)");
                       return false;
                   }
                   if($("#purchaseDate").val().length<1){
                       layer.msg("请输入获取日期");
                       return false;
                   }
                   if($("#assetsSource").val().length<1){
                       layer.msg("请输入资产来源（下拉选）");
                       return false;
                   }
                   if($("#depositAddress").val().length<1){
                       layer.msg("请输入存放地点");
                       return false;
                   }
                   if($("#affiliatedUnits").val().length<1){
                       layer.msg("请输入所属单位(下拉选)");
                       return false;
                   }
                   if($("#approvalState").val().length<1){
                       layer.msg("请输入0未提交/1待审批/2审批通过/3审批不通过");
                       return false;
                   }
                   if($("#oddNumber").val().length<1){
                       layer.msg("请输入日期单号");
                       return false;
                   }
                   if($("#errerReason").val().length<1){
                       layer.msg("请输入批次审批不通过原因");
                       return false;
                   }
                   if($("#approvalUserId").val().length<1){
                       layer.msg("请输入审批人ID");
                       return false;
                   }
                   if($("#updateTime").val().length<1){
                       layer.msg("请输入更新时间(上次审批时间)");
                       return false;
                   }
                   if($("#createTime").val().length<1){
                       layer.msg("请输入创建时间");
                       return false;
                   }
        }
    });

</script>
</body>
</html>